package local

import (
	wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
	"xiuxian_help_tool/backend/app"
)
import "runtime"

type MessageService struct {
}

var MessageServiceApp = new(MessageService)

func (m *MessageService) OpenMsgDialog(t, title, msg string) (string, error) {
	ctx := app.App().Ctx()
	if isMac() {
		return wailsRuntime.MessageDialog(ctx, wailsRuntime.MessageDialogOptions{
			Title:   title,
			Message: msg,
			Buttons: []string{"好"},
		})
	} else if isWindows() {
		return wailsRuntime.MessageDialog(ctx, wailsRuntime.MessageDialogOptions{
			Type:          wailsRuntime.DialogType(t),
			Title:         title,
			Message:       msg,
			DefaultButton: "好",
		})
	}
	return "", nil
}

func msgType(t int) {

}

func isMac() bool {
	return runtime.GOOS == "darwin"
}

func isWindows() bool {
	return runtime.GOOS == "windows"
}
